
var pro_load_page = 2,pro_load_flag = true;
	header.init('订单数');
	footer.init();

var shopOrder ={
	init :function(url,data){
		app.ajax(
			url,
			data,
			function(res){
				if(res.code == 200){
					if(res.order_list.length > 0){
					app.tpl($('.shop-order'),'tpl-shop-order',res);
					}else{
						$('.shop-order').html("<div class='tC promp-order' style='position:absolute;top:50%;left:15%;height:30%;width:70%;'><span class='cGrey fS15'>亲  这个页面还没有数据哦~</span></div>");
					}
				}else{
					layer.msg('网络繁忙，请稍候再试');
				}
		});
	},
	loadMore :function(url,data){
		var listLoadingEmpty = '<div style="height:3rem;line-height:3rem;text-align:center;font-size:1.2rem;" class="no-more">努力加载中~<div>';
   		$('.shop-order').append(listLoadingEmpty);
		pro_load_flag = false;
		app.ajax(
			url,
			data,
			function(res){
				$('.shop-order .no-more').remove();
				if(res.code == 200){
						app.tpladd($('.shop-order'),'tpl-shop-order',res);						
						pro_load_page++;
						pro_load_flag = true;
					//page++;
				}else{						
						var listLoadingEmpty = '<div style="height:3rem;line-height:3rem;text-align:center;font-size:1.2rem;">没有更多数据了~<div>';
						$('.shop-order').append(listLoadingEmpty);
				}
			});	
	}
}

shopOrder.init('/Member/Shop/shop_order_list',{page:1});
window.onload = function(){
	setTimeout(function(){
		var swiper = new Swiper('.swiper-container', {
	        slidesPerView: 4,
	        paginationClickable: true,
	        spaceBetween: 30
   		 });
	},2000);
	
	$(window).scroll(function(){
		// 当滚动到距底部以上200像素
		var offset = $(".shop-order").offset(),
		dataType = 0,
		data = {};
		var documentHeight = offset.top + $(".shop-order").height();
		if (documentHeight - $(this).scrollTop() - $(this).height()<100){
				data = {
					page :pro_load_page,
					limit : 10
				};
			pro_load_flag && shopOrder.loadMore('/Member/Shop/shop_order_list',data);
		}
	});
	
};

